package com.example.business.demo.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.business.demo.dto.DemoDTO;
import com.example.business.demo.service.DemoService;
import com.example.common.dto.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Demo控制器
 */
@RestController
@RequestMapping("/api/demo")
@Api(tags = "Demo管理接口")
public class DemoController {
    
    @Autowired
    private DemoService demoService;
    
    @GetMapping("/list")
    @ApiOperation("分页查询有效的Demo数据")
    public BaseResponse<Page<DemoDTO>> listActiveDemos(
            @ApiParam(value = "页码", defaultValue = "1") 
            @RequestParam(defaultValue = "1") Integer pageNum,
            @ApiParam(value = "每页大小", defaultValue = "10") 
            @RequestParam(defaultValue = "10") Integer pageSize) {
        
        Page<DemoDTO> page = demoService.queryActiveDemos(pageNum, pageSize);
        return new BaseResponse<>(200, "查询成功", page);
    }
} 